<?xml version="1.0" encoding="UTF-8"?>
<deploymentAction>
  <actions componentType="product" step="Download">
    <action commandToExecute="Copy-PackageContent" sequence="1" supportWhatif="true" userFriendlyName="Download product source">
      <arguments>
        <argument name="-Path" value="{{@productRepository}}" />
        <argument name="-PackageName" value="{{@packageName}}"  />
        <argument name="-Destination" value="{{../@localSourceFolder}}\{{@packageName}}" />
      </arguments>
    </action>
  </actions>
  <actions componentType="product" step="Install">
    <action commandToExecute="Invoke-msi" sequence="1" supportWhatif="true" userFriendlyName="Use msiexec to install product">
      <arguments>
        <argument name="-Path" value="{{../@productSourceFolder}}\{{@packageName}}" />
        <argument name="-MSIFileName" value="{{@msiFile}}"/>
        <argument name="-MSIAction" value="/i"/>
        <argument name="-Destination" value="{{@InstallationDirectory}}" />
        <argument name="-AdditionalCommandProperties" value="{{@additionalParams}}" />
      </arguments>
    </action>
  </actions>
  <!-- Portail WOA -->
  <!-- Portail WOA : Stop -->
  <actions componentName="PortailWoa" step="Stop">
    <action commandToExecute="Deploy-AppOffline" sequence="1" supportWhatif="true" userFriendlyName="Deploy App_Offline">
      <arguments>
        <argument name="-toolsFolder" value="{{../@toolsFolder}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-targetFolder" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
    <action commandToExecute="C:\Windows\System32\inetsrv\appcmd.exe" sequence="2" supportWhatif="false" supportVerbose="false" userFriendlyName="Stop application Pool">
      <arguments>
        <argument name="STOP APPPOOL" value="{{@applicationPoolName}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
  </actions>
  <!-- Portail WOA : Start -->
  <actions componentName="PortailWoa" step="Start">
    <action commandToExecute="Remove-AppOffline" sequence="1" supportWhatif="true" userFriendlyName="Remove App_Offline">
      <arguments>
        <argument name="-targetFolder" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
    <action commandToExecute="C:\Windows\System32\inetsrv\appcmd.exe" sequence="2" supportWhatif="false" supportVerbose="false" userFriendlyName="Start application Pool">
      <arguments>
        <argument name="START APPPOOL" value="{{@applicationPoolName}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
  </actions>
  <!-- Portail WOA : Inventory -->
  <actions componentName="PortailWoa" step="Inventory">
    <action commandToExecute="Get-BinariesVersion" sequence="1" supportWhatif="false" userFriendlyName="Retrieve list of binaries for the component">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
  </actions>
  <!-- Portail WOA : Install -->
  <actions componentName="PortailWoa" step="Install">
    <action commandToExecute="Save-Folder" sequence="1" supportWhatif="false" userFriendlyName="Backup original folder">
      <arguments>
        <argument name="-Source" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{../@backupFolder}}" />
      </arguments>
    </action>
    <action commandToExecute="Get-ChildItem" sequence="2" supportWhatif="false" userFriendlyName="Clean original folder">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Exclude ('App_Offline.htm', 'logo.png') -Recurse"  />
        <argument name="| Remove-Item -Recurse -Force"  />
      </arguments>
    </action>
    <action commandToExecute="Copy-PackageContent" sequence="3" supportWhatif="false" userFriendlyName="Deploy the content of the package">
      <arguments>
        <argument name="-Path" value="{{../@workdirFolder}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-PackageName" value="{{@packageName}}"  />
        <argument name="-Destination" value="{{@InstallationDirectory}}" />
      </arguments>
    </action>
  </actions>
  <!-- Portail Webapi -->
  <!-- Portail Webapi : Inventory -->
  <actions componentName="PortailWebapi" step="Inventory">
    <action commandToExecute="Get-BinariesVersion" sequence="1" supportWhatif="false" userFriendlyName="Retrieve list of binaries for the component">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
  </actions>
  <!-- Portail Webapi : Install -->
  <actions componentName="PortailWebapi" step="Install">
    <action commandToExecute="Save-Folder" sequence="1" supportWhatif="false" userFriendlyName="Backup original folder">
      <arguments>
        <argument name="-Source" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{../@backupFolder}}" />
      </arguments>
    </action>
    <action commandToExecute="Get-ChildItem" sequence="2" supportWhatif="false" userFriendlyName="Clean original folder">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Exclude ('App_Offline.htm', 'logo.png') -Recurse"  />
        <argument name="| Remove-Item -Recurse -Force"  />
      </arguments>
    </action>
    <action commandToExecute="Copy-PackageContent" sequence="3" supportWhatif="false" userFriendlyName="Deploy the content of the package">
      <arguments>
        <argument name="-Path" value="{{../@workdirFolder}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-PackageName" value="{{@packageName}}"  />
        <argument name="-Destination" value="{{@InstallationDirectory}}" />
      </arguments>
    </action>
  </actions>
  <!-- Business Services -->
  <!-- Business Services : Inventory -->
  <actions componentName="BusinessServices" step="Inventory">
    <action commandToExecute="Get-BinariesVersion" sequence="1" supportWhatif="false" userFriendlyName="Retrieve list of binaries for the component">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
  </actions>
  <!-- Business Services : Stop -->
  <actions componentName="BusinessServices" step="Stop">
    <action commandToExecute="Deploy-AppOffline" sequence="1" supportWhatif="true" userFriendlyName="Deploy App_Offline">
      <arguments>
        <argument name="-toolsFolder" value="{{../@toolsFolder}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-targetFolder" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
    <action commandToExecute="C:\Inetpub\AdminScripts\adsutil.vbs" sequence="2" supportWhatif="false" supportVerbose="false" userFriendlyName="Start application Pool">
      <arguments>
        <argument name="STOP_SERVER" value="W3SVC/AppPools/{{@applicationPoolName}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
  </actions>
  <!-- Business Services : Start -->
  <actions componentName="BusinessServices" step="Start">
    <action commandToExecute="Remove-AppOffline" sequence="1" supportWhatif="true" userFriendlyName="Remove App_Offline">
      <arguments>
        <argument name="-targetFolder" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
    <action commandToExecute="C:\Inetpub\AdminScripts\adsutil.vbs" sequence="2" supportWhatif="false" supportVerbose="false" userFriendlyName="Start application Pool">
      <arguments>
        <argument name="START_SERVER" value="W3SVC/AppPools/{{@applicationPoolName}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
  </actions>
  <!-- Business Services : Install -->
  <actions componentName="BusinessServices" step="Install">
    <action commandToExecute="Save-Folder" sequence="1" supportWhatif="false" userFriendlyName="Backup original folder">
      <arguments>
        <argument name="-Source" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{../@backupFolder}}" />
      </arguments>
    </action>
    <action commandToExecute="Get-ChildItem" sequence="2" supportWhatif="false" userFriendlyName="Clean original folder">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Exclude ('App_Offline.htm', 'logo.png') -Recurse"  />
        <argument name="| Remove-Item -Recurse -Force"  />
      </arguments>
    </action>
    <action commandToExecute="Copy-PackageContent" sequence="3" supportWhatif="false" userFriendlyName="Deploy the content of the package">
      <arguments>
        <argument name="-Path" value="{{../@workdirFolder}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-PackageName" value="{{@packageName}}"  />
        <argument name="-Destination" value="{{@InstallationDirectory}}" />
      </arguments>
    </action>
  </actions>
  <!-- Configuration Services -->
  <!-- Configuration Services : Inventory -->
  <actions componentName="ConfigurationServices" step="Inventory">
    <action commandToExecute="Get-BinariesVersion" sequence="1" supportWhatif="false" userFriendlyName="Retrieve list of binaries for the component">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
  </actions>
  <!-- Business Services : Install -->
  <actions componentName="ConfigurationServices" step="Install">
    <action commandToExecute="Save-Folder" sequence="1" supportWhatif="false" userFriendlyName="Backup original folder">
      <arguments>
        <argument name="-Source" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{../@backupFolder}}" />
      </arguments>
    </action>
    <action commandToExecute="Get-ChildItem" sequence="2" supportWhatif="false" userFriendlyName="Clean original folder">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Exclude ('App_Offline.htm', 'logo.png') -Recurse"  />
        <argument name="| Remove-Item -Recurse -Force"  />
      </arguments>
    </action>
    <action commandToExecute="Copy-PackageContent" sequence="3" supportWhatif="false" userFriendlyName="Deploy the content of the package">
      <arguments>
        <argument name="-Path" value="{{../@workdirFolder}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-PackageName" value="{{@packageName}}"  />
        <argument name="-Destination" value="{{@InstallationDirectory}}" />
      </arguments>
    </action>
  </actions>
  <!-- Monitoring Core : Inventory -->
  <actions componentName="MonitoringCore" step="Inventory">
    <action commandToExecute="Get-BinariesVersion" sequence="1" supportWhatif="false" userFriendlyName="Retrieve list of binaries for the component">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
      </arguments>
    </action>
  </actions>
  <!-- Monitoring Core : Install -->
  <actions componentName="MonitoringCore" step="Install">
    <action commandToExecute="Save-Folder" sequence="1" supportWhatif="false" userFriendlyName="Backup original folder">
      <arguments>
        <argument name="-Source" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{../@backupFolder}}" />
      </arguments>
    </action>
    <action commandToExecute="Get-ChildItem" sequence="2" supportWhatif="false" userFriendlyName="Clean original folder">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Recurse"  />
        <argument name="| Remove-Item -Recurse -Force"  />
      </arguments>
    </action>
    <action commandToExecute="Copy-PackageContent" sequence="3" supportWhatif="false" userFriendlyName="Deploy the content of the package">
      <arguments>
        <argument name="-Path" value="{{../@workdirFolder}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-PackageName" value="{{@packageName}}"  />
        <argument name="-Destination" value="{{@InstallationDirectory}}" />
      </arguments>
    </action>
  </actions>
  <!-- Monitoring Webapp : Install -->
  <actions componentName="MonitoringWebApp" step="Install">
    <action commandToExecute="Copy-Item" sequence="1" supportWhatif="false" userFriendlyName="Deploy core monitoring dll">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}\Monitoring\*.dll" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{@targetedFolder}}" />
        <argument name="-Force"  />
      </arguments>
    </action>
    <action commandToExecute="Copy-Item" sequence="2" supportWhatif="false" userFriendlyName="Deploy webapi monitoring dll">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}\Monitoring.WebApi\*.dll" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{@targetedFolder}}" />
        <argument name="-Force"  />
      </arguments>
    </action>
  </actions>
  <!-- Monitoring WCF : Install -->
  <actions componentName="MonitoringWCF" step="Install">
    <action commandToExecute="Copy-Item" sequence="1" supportWhatif="false" userFriendlyName="Deploy core monitoring dll">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}\Monitoring\*.dll" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{@targetedFolder}}" />
        <argument name="-Force"  />
      </arguments>
    </action>
    <action commandToExecute="Copy-Item" sequence="2" supportWhatif="false" userFriendlyName="Deploy WCF monitoring dll">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}\Monitoring.WCF\*.dll" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{@targetedFolder}}" />
        <argument name="-Force"  />
      </arguments>
    </action>
    <action commandToExecute="{{@InstallationDirectory}}\gacutil.exe" sequence="3" supportVerbose="false" userFriendlyName="Deploy core monitoring dll">
      <arguments>
        <argument name="/i" value="{{@InstallationDirectory}}\Monitoring\Monitoring.dll" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="/f"  />
      </arguments>
    </action>
    <action commandToExecute="{{@InstallationDirectory}}\gacutil.exe" sequence="4" supportVerbose="false" userFriendlyName="Deploy core monitoring dll">
      <arguments>
        <argument name="/i" value="{{@InstallationDirectory}}\Monitoring\Monitoring.Model.dll" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="/f"  />
      </arguments>
    </action>
    <action commandToExecute="{{@InstallationDirectory}}\gacutil.exe" sequence="5" supportVerbose="false" userFriendlyName="Deploy core monitoring dll">
      <arguments>
        <argument name="/i" value="{{@InstallationDirectory}}\Monitoring.WCF\Monitoring.WCF.dll" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="/f"  />
      </arguments>
    </action>
  </actions>
  <!-- Tools : Install -->
  <actions componentName="Tools" step="Install">
    <action commandToExecute="Save-Folder" sequence="1" supportWhatif="false" userFriendlyName="Backup original folder">
      <arguments>
        <argument name="-Source" value="{{@InstallationDirectory}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-Destination" value="{{../@backupFolder}}" />
      </arguments>
    </action>
    <action commandToExecute="Copy-PackageContent" sequence="3" supportWhatif="false" userFriendlyName="Deploy the content of the package">
      <arguments>
        <argument name="-Path" value="{{../@workdirFolder}}" />
        <!-- Add dynamic lookup on deploymenTarget to retrieve Service Name-->
        <argument name="-PackageName" value="{{@packageName}}"  />
        <argument name="-Destination" value="{{@InstallationDirectory}}" />
      </arguments>
    </action>
  </actions>
  <!-- Windows service : Inventory -->
  <actions componentType="WindowsService" step="Inventory">
    <action commandToExecute="Get-BinariesVersion" sequence="1" supportWhatif="false">
      <arguments>
        <argument name="-Path" value="{{@InstallationDirectory}}" />
      </arguments>
    </action>
    <action commandToExecute="Get-WindowsServiceProperties" sequence="1" supportWhatif="false">
      <arguments>
        <argument name="-Name" value="{{@serviceName}}" />
      </arguments>
    </action>
  </actions>
  <!-- Windows service : stop -->
  <actions componentType="WindowsService" step="stop">
    <action commandToExecute="Get-WindowsServiceProperties" sequence="1" supportWhatif="false">
      <arguments>
        <argument name="-Name" value="{{@serviceName}}" />
      </arguments>
    </action>
    <action commandToExecute="Stop-WindowsService" sequence="2" supportWhatif="true">
      <arguments>
        <argument name="-Name" value="{{@serviceName}}" />
      </arguments>
    </action>
  </actions>
  <!-- Windows service : stop -->
  <actions componentType="WindowsService" step="start">
    <action commandToExecute="Get-WindowsServiceProperties" sequence="1" supportWhatif="false">
      <arguments>
        <argument name="-Name" value="{{@serviceName}}" />
      </arguments>
    </action>
    <action commandToExecute="Start-WindowsService" sequence="2" supportWhatif="true">
      <arguments>
        <argument name="-Name" value="{{@serviceName}}" />
      </arguments>
    </action>
  </actions>
</deploymentAction>